<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-CN">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />



  <meta name="google-site-verification" content="6Ik8pGDtBtOTGCKiPW_YXR0Wqp7FfhOllj0Bi92eBDo" />







  <meta name="baidu-site-verification" content="code-uIla4FKPmw" />







  
  
  <link href="/berlinblog/libs/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/berlinblog/libs/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/berlinblog/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="微信小程序,Vue,Element," />





  <link rel="alternate" href="/berlinblog/atom.xml" title="白叁木小肆" type="application/atom+xml" />




  <link rel="shortcut icon" type="image/x-icon" href="https://raw.githubusercontent.com/A-limon/pacman/master/source/img/favicon.ico?v=5.1.2" />






<meta name="description" content="Abstract ： 根据需求搭建一个Vue + mpvue的微信小程序">
<meta property="og:type" content="article">
<meta property="og:title" content="VUE + mpvue 项目初始化">
<meta property="og:url" content="https://berlinwong.gitee.io/berlinblog/2021/09/09/Vue-mpvue/index.html">
<meta property="og:site_name" content="白叁木小肆">
<meta property="og:description" content="Abstract ： 根据需求搭建一个Vue + mpvue的微信小程序">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909141806648.png">
<meta property="og:image" content="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909142020600.png">
<meta property="og:image" content="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909142326237.png">
<meta property="og:image" content="https://gitee.com/berlinwong/picgo/raw/master/img/20210909150220.png">
<meta property="og:image" content="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909144554139.png">
<meta property="og:image" content="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909144649428.png">
<meta property="og:image" content="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909144723616.png">
<meta property="og:image" content="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909144907459.png">
<meta property="article:published_time" content="2021-09-09T06:10:41.000Z">
<meta property="article:modified_time" content="2021-10-21T17:05:10.310Z">
<meta property="article:author" content="Berlin">
<meta property="article:tag" content="微信小程序">
<meta property="article:tag" content="Vue">
<meta property="article:tag" content="Element">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909141806648.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '',
    scheme: 'Gemini',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":12,"b2t":true,"scrollpercent":true,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://berlinwong.gitee.io/berlinblog/2021/09/09/Vue-mpvue/"/>





  <title>VUE + mpvue 项目初始化 | 白叁木小肆</title>
  














<meta name="generator" content="Hexo 5.4.0"></head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta custom-logo">
    

    <div class="custom-logo-site-title">
      <a href="/berlinblog/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">白叁木小肆</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">当一个快乐的码农吧！</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/berlinblog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/berlinblog/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            Tags
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/berlinblog/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            Categories
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/berlinblog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            Archives
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/berlinblog/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            About
          </a>
        </li>
      
        
        <li class="menu-item menu-item-sitemap">
          <a href="/berlinblog/sitemap.xml" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-sitemap"></i> <br />
            
            Sitemap
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://berlinwong.gitee.io/berlinblog/berlinblog/2021/09/09/Vue-mpvue/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/berlinblog/images/avatar.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="白叁木小肆">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">VUE + mpvue 项目初始化</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2021-09-09T14:10:41+08:00">
                2021-09-09
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">In</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/berlinblog/categories/%E4%BB%A3%E7%A0%81%E5%AE%9E%E6%88%98/" itemprop="url" rel="index">
                    <span itemprop="name">代码实战</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          


          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p><strong>Abstract</strong> ： 根据需求搭建一个Vue + mpvue的微信小程序</p>
<span id="more"></span>

<h2 id="1-下载微信开发者工具"><a href="#1-下载微信开发者工具" class="headerlink" title="1. 下载微信开发者工具"></a>1. 下载微信开发者工具</h2><p><img src="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909141806648.png" alt="image-20210909141806648"></p>
<p><a target="_blank" rel="noopener" href="https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html">官方下载地址</a> 个人建议下载稳定版</p>
<p><img src="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909142020600.png" alt="image-20210909142020600"></p>
<p>完成！</p>
<h2 id="2-验视"><a href="#2-验视" class="headerlink" title="2.  验视"></a>2.  验视</h2><p><img src="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909142326237.png" alt="image-20210909142326237"></p>
<p>没问题！开始生成项目！</p>
<h2 id="3-生成项目"><a href="#3-生成项目" class="headerlink" title="3. 生成项目"></a>3. 生成项目</h2><h3 id="3-1-安装全局脚手架"><a href="#3-1-安装全局脚手架" class="headerlink" title="3.1 安装全局脚手架"></a>3.1 安装全局脚手架</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo npm i -g @vue/cli-init</span><br></pre></td></tr></table></figure>

<h3 id="3-2-创建项目"><a href="#3-2-创建项目" class="headerlink" title="3.2 创建项目"></a>3.2 创建项目</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vue init mpvue/mpvue-quickstart marriage </span><br></pre></td></tr></table></figure>

<h3 id="3-3-在WebStorm中打开"><a href="#3-3-在WebStorm中打开" class="headerlink" title="3.3 在WebStorm中打开"></a>3.3 在WebStorm中打开</h3><p><img src="https://gitee.com/berlinwong/picgo/raw/master/img/20210909150220.png" alt="image-20210909144012594"></p>
<h4 id="3-3-1-安装依赖"><a href="#3-3-1-安装依赖" class="headerlink" title="3.3.1 安装依赖"></a>3.3.1 安装依赖</h4><p>打开后，首先运行<code>yarn</code>安装依赖</p>
<h4 id="3-3-2-进入开发模式"><a href="#3-3-2-进入开发模式" class="headerlink" title="3.3.2 进入开发模式"></a>3.3.2 进入开发模式</h4><p>安装完成后，让代码运行起来，进入开发模式：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm run dev</span><br></pre></td></tr></table></figure>

<h3 id="3-4-在微信开发者工具中打开项目"><a href="#3-4-在微信开发者工具中打开项目" class="headerlink" title="3.4 在微信开发者工具中打开项目"></a>3.4 在微信开发者工具中打开项目</h3><p><img src="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909144554139.png" alt="image-20210909144554139"></p>
<p><img src="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909144649428.png" alt="image-20210909144649428"></p>
<p><img src="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909144723616.png" alt="image-20210909144723616"></p>
<p>此处选择使用测试号，设置好项目名称后点击确定，导入</p>
<p><img src="https://gitee.com/berlinwong/picgo/raw/master/img/image-20210909144907459.png" alt="image-20210909144907459"></p>
<p>稍等片刻导入成功！</p>
<p>开始开心敲代码吧！</p>

      
    </div>
    
    
    
    
      <div style="text-align:center;color: #634db5;font-size:12px;">
-------------  本文结束 <i class="fa fa-cog fa-spin fa-1x fa-fw"></i> 感谢阅读  -------------
</div>

    
    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/berlinblog/tags/%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F/" rel="tag"><i class="fa fa-tag"></i> 微信小程序</a>
          
            <a href="/berlinblog/tags/Vue/" rel="tag"><i class="fa fa-tag"></i> Vue</a>
          
            <a href="/berlinblog/tags/Element/" rel="tag"><i class="fa fa-tag"></i> Element</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/berlinblog/2021/09/07/gitee%E7%94%9F%E6%88%90%E5%85%AC%E9%92%A5/" rel="next" title="Gitee SSH 公钥生成与配置">
                <i class="fa fa-chevron-left"></i> Gitee SSH 公钥生成与配置
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/berlinblog/2021/09/12/%E6%B5%85%E6%9E%90Servlet/" rel="prev" title="浅尝Servlet">
                浅尝Servlet <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            Overview
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/berlinblog/images/avatar.png"
               alt="" />
          <p class="site-author-name" itemprop="name"></p>
           
              <p class="site-description motion-element" itemprop="description"></p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/berlinblog/archives/">
                <span class="site-state-item-count">17</span>
                <span class="site-state-item-name">posts</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/berlinblog/categories/index.html">
                <span class="site-state-item-count">4</span>
                <span class="site-state-item-name">categories</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/berlinblog/tags/index.html">
                <span class="site-state-item-count">17</span>
                <span class="site-state-item-name">tags</span>
              </a>
            </div>
          

        </nav>

        
          <div class="feed-link motion-element">
            <a href="/berlinblog/atom.xml" rel="alternate">
              <i class="fa fa-rss"></i>
              RSS
            </a>
          </div>
        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://gitee.com/berlinwong" target="_blank" title="Gitee">
                  
                    <i class="fa fa-fw fa-git"></i>
                  
                    
                      Gitee
                    
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="wzysws@gmail.com" target="_blank" title="E-Mail">
                  
                    <i class="fa fa-fw fa-envelope"></i>
                  
                    
                      E-Mail
                    
                </a>
              </span>
            
          
        </div>

        
        
          <div class="cc-license motion-element" itemprop="license">
            <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" target="_blank">
              <img src="/berlinblog/images/cc-by-nc-sa.svg" alt="Creative Commons" />
            </a>
          </div>
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E4%B8%8B%E8%BD%BD%E5%BE%AE%E4%BF%A1%E5%BC%80%E5%8F%91%E8%80%85%E5%B7%A5%E5%85%B7"><span class="nav-number">1.</span> <span class="nav-text">1. 下载微信开发者工具</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E9%AA%8C%E8%A7%86"><span class="nav-number">2.</span> <span class="nav-text">2.  验视</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E7%94%9F%E6%88%90%E9%A1%B9%E7%9B%AE"><span class="nav-number">3.</span> <span class="nav-text">3. 生成项目</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-%E5%AE%89%E8%A3%85%E5%85%A8%E5%B1%80%E8%84%9A%E6%89%8B%E6%9E%B6"><span class="nav-number">3.1.</span> <span class="nav-text">3.1 安装全局脚手架</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-%E5%88%9B%E5%BB%BA%E9%A1%B9%E7%9B%AE"><span class="nav-number">3.2.</span> <span class="nav-text">3.2 创建项目</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3-%E5%9C%A8WebStorm%E4%B8%AD%E6%89%93%E5%BC%80"><span class="nav-number">3.3.</span> <span class="nav-text">3.3 在WebStorm中打开</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#3-3-1-%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96"><span class="nav-number">3.3.1.</span> <span class="nav-text">3.3.1 安装依赖</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-3-2-%E8%BF%9B%E5%85%A5%E5%BC%80%E5%8F%91%E6%A8%A1%E5%BC%8F"><span class="nav-number">3.3.2.</span> <span class="nav-text">3.3.2 进入开发模式</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-4-%E5%9C%A8%E5%BE%AE%E4%BF%A1%E5%BC%80%E5%8F%91%E8%80%85%E5%B7%A5%E5%85%B7%E4%B8%AD%E6%89%93%E5%BC%80%E9%A1%B9%E7%9B%AE"><span class="nav-number">3.4.</span> <span class="nav-text">3.4 在微信开发者工具中打开项目</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-ravelry"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Berlin</span>
</div>



        

        
      </div>
    </footer>

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/berlinblog/libs/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/berlinblog/libs/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/berlinblog/libs/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/berlinblog/libs/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/berlinblog/libs/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/berlinblog/libs/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/berlinblog/js/src/utils.js?v=5.1.2"></script>

  <script type="text/javascript" src="/berlinblog/js/src/motion.js?v=5.1.2"></script>



  
  


  <script type="text/javascript" src="/berlinblog/js/src/affix.js?v=5.1.2"></script>

  <script type="text/javascript" src="/berlinblog/js/src/schemes/pisces.js?v=5.1.2"></script>



  
  <script type="text/javascript" src="/berlinblog/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/berlinblog/js/src/post-details.js?v=5.1.2"></script>



  


  <script type="text/javascript" src="/berlinblog/js/src/bootstrap.js?v=5.1.2"></script>



  


  




	





  





  






  





  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  

  

  

  

</body>
</html>
